'use strict';

const { Controller } = require('egg');

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  // const { router, controller, jwt } = app;
  const { router, controller } = app;
  router.post('/auditorder', controller.order.auditorder);

  // router.get('/', controller.home.index);
  router.get('/login', controller.login.index);
  router.get('/exit', controller.login.exit);
  router.get('/test', controller.login.exit2);
  router.get('/products', controller.products.getproducts);
  router.get('/alluserinfo', controller.userinfo.getusers);
  router.get('/userinfo', controller.userinfo.getuserinfo);
  router.get('/userorder', controller.order.getuserorder);
  router.get('/userorderinfo', controller.order.getuserorderinfo);
  router.get('/orders', controller.order.getorders);
  router.get('/clientorder', controller.order.getclientorders);

  router.get('/mapdata', controller.order.getmapdata);

  router.get('/mapsearch', controller.order.getuserorder_mapsearch);
  router.get('/orderproduct', controller.products.getorderproduct);
  router.get('/getmysend', controller.products.getmysend);
  router.get('/getnewslist', controller.news.getnewslist);
  router.get('/delproduct', controller.products.delproduct);
  router.get('/delorder', controller.order.delorder);
  router.get('/dellike', controller.news.dellike);
  router.get('/adminDellike', controller.news.adminDellike);
  router.get('/delnew', controller.news.delnew);
  router.get('/deluser', controller.userinfo.deluser);

  router.get('/isChecked', controller.news.isChecked);
  router.get('/getmylike', controller.news.getmylike);
  router.get('/getallnewlike', controller.news.getallnewlike);
  router.get('/getallproductlike', controller.news.getallproductlike);

  router.get('/topdata', controller.home.topdata);
  router.get('/getecharts', controller.home.getecharts);
  router.get('/getfourecharts', controller.home.getfourecharts);
  router.get('/getordertable', controller.home.getordertable);


  router.post('/register', controller.register.index);
  router.post('/order', controller.order.index);
  router.post('/sendproduct', controller.products.postproduct);
  router.post('/userup', controller.register.userup);
  router.post('/addlike', controller.news.addlike);
  router.post('/addnew', controller.news.addnew);

  router.post('/updateuserinfo', controller.userinfo.updateuserinfo);
  router.post('/updateorder', controller.order.updateorder);
  router.post('/updateproduct', controller.products.updateproduct);
  router.post('/updatenew', controller.news.updatenew);
  router.post('/updateadmininfo', controller.userinfo.updateadmininfo);


  router.post('/posttest', controller.test.posttest);


  // 后台管理
  router.post('/admin_login', controller.login.admin_login);
  router.get('/admin_getuserinfo', controller.login.admin_getuserinfo);

  // 测试jwt
  // router.get('/testjwt', controller.test.testjwt);
  // router.get('/testjwtlogin', jwt, controller.test.testjwtlogin);
  // router.post('/testjwtloginpost', jwt, controller.test.testjwtloginpost);


  // test
  router.get('/test1', controller.test.test1);
  router.get('/test2', controller.test.test2);
  router.get('/test3/:name/:age', controller.test.test3);

  router.post('/testurl', controller.test.testurl);
  router.get('/geturl', controller.test.geturl);

  router.get('/map', controller.test.maptest);

  router.get('/getnowdatatest', controller.test.getnowdatatest);

};
